package org.tp8.sampleapp.scheduler.job;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.tp8.sampleapp.exc.SampleAppException;
import org.tp8.sampleapp.scheduler.task.SampleTask;

/**
 * The Class SampleJob.
 */
public class SampleJob extends QuartzJobBean {

	/** The sample task. */
	private SampleTask sampleTask;

	/**
	 * Sets the my task.
	 * 
	 * @param sampleTask
	 *            the new my task
	 */
	public void setSampleTask(SampleTask sampleTask) {
		this.sampleTask = sampleTask;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.springframework.scheduling.quartz.QuartzJobBean#executeInternal(org
	 * .quartz.JobExecutionContext)
	 */
	@Override
	protected void executeInternal(JobExecutionContext arg0)
			throws JobExecutionException {
		try {
			sampleTask.printCurrentTime();
		} catch (SampleAppException e) {
			throw new JobExecutionException(e);
		}

	}

}